<template>
  <div class="list">
    <div class="top">
      <div
        class="shopping"
        @click="goshopping(index)"
        :class="{ active: currentIndex == index }"
        v-for="(item, index) in arr"
        :key="index"
      >
        {{ item }}
      </div>
    </div>
    <div
      class="goods"
      v-for="(item, index) in shoplist1"
      :key="item.id"
      v-show="currentIndex == 0"
    >
      <div class="imgs">
        <img :src="item.picture" alt="" />
      </div>
      <div class="text">
        <span>{{ item.name }}</span>
        <div class="name">
          <span>￥{{ item.min_price }}</span>
          <span class="qiang" @click="goqiang(item, index)">去抢</span>
        </div>
      </div>
    </div>
    <div
      class="goods"
      v-for="(item, index) in shoplist2"
      :key="item.index"
      v-show="currentIndex == 1"
    >
      <div class="imgs">
        <img :src="item.picture" alt="" />
      </div>
      <div class="text">
        <span>{{ item.name }}</span>
        <div class="name">
          <span>￥{{ item.min_price }}</span>
          <span class="qiang" @click="goqiang(item, index)"> 已抢完 </span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["shoplist1", "shoplist2", "currentIndex"],
  data() {
    return {
      arr: ["正在抢购", "上新预告"],
    };
  },
  methods: {
    goshopping(index) {
      this.currentIndex = index;
    },
    goqiang(item, index) {
      item.btn = true;
    },
  },
};
</script>

<style lang="scss" scoped>
html,
body {
  height: 100%;
}
.list {
  width: 100%;

  margin-top: 150px;
  background: whitesmoke;
  position: relative;
}
.list .goods {
  display: flex;
  align-items: center;
  padding: 10px;
}
.list .goods .imgs {
  width: 70px;
}
.list .goods .imgs img {
  width: 100%;
}
.list .goods .text {
  flex: 1;
}
.list .goods .text .name {
  display: flex;
  justify-content: space-between;
}
.list .goods .text .name .qiang {
  padding: 10px;
  color: white;
  background: red;
  border-radius: 20px;
}
.top {
  width: 100%;
  height: 40px;
  font-size: 20px;
  font-weight: 700;
  display: flex;
}
.top .shopping {
  margin-right: 20px;
  padding: 10px;
}
.active {
  color: #eb4825;
}
</style>